//
//  AboutUsController.m
//  NPS
//
//  Created by jadd on 15/10/23.
//  Copyright © 2015年 jadd. All rights reserved.
//

#import "AboutUsController.h"

@implementation AboutUsController


-(void) setUpView
{
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, K_ScreenWidth, K_ScreenHeight)];
    view.backgroundColor = BACK_VIEW_COLOR;
    [self.view addSubview:view];
    
    UIImageView *imgView = [[UIImageView alloc]init];
    CALayer *layer= [imgView layer];
    //是否设置边框以及是否可见
    [layer setMasksToBounds:YES];
    //设置边框圆角的弧度
    [layer setCornerRadius:20.0];
    //设置边框线的宽
    [layer setBorderWidth:1];
    [layer setBorderColor:DEFAULT_LINE_GRAY_COLOR.CGColor];
  
    [imgView setImage:[UIImage imageNamed:@"logobg"]];
    [view addSubview:imgView];
    [imgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(view.mas_centerY).with.offset(-140);
        make.centerX.equalTo(view.mas_centerX);
    }];
    
    NSString *version = [[NSString alloc] initWithFormat:@"V%@",[Config getAppVersion]];
    UILabel *versionLbl = [[UILabel alloc] init];
    [versionLbl setText:version];
    [versionLbl setTextColor:GRAY];
    versionLbl.textAlignment = NSTextAlignmentCenter;
    versionLbl.adjustsFontSizeToFitWidth = YES;
    versionLbl.font = [UIFont systemFontOfSize:20];
    [view addSubview:versionLbl];
    [versionLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(imgView.mas_bottom).with.offset(15);
        make.centerX.equalTo(view.mas_centerX);
    }];
    
    UILabel *lable= [[UILabel alloc] init];
    lable.textAlignment = NSTextAlignmentCenter;
    lable.text = @"上海众言网络科技有限公司 版权所有";
    [lable setFont:[UIFont systemFontOfSize:18]];
    [lable setTextColor:GRAY];
    [view addSubview:lable];
    [lable  mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(view.mas_bottom).with.offset(-80);
        make.centerX.equalTo(view.mas_centerX);
        make.right.offset(-10);
        make.left.offset(10);
    }];
    
    UILabel *lbl= [[UILabel alloc] init];
    lbl.text = @"Copyright © 2008 - 2015 爱调研. All Rights Reserved.";
    lbl.adjustsFontSizeToFitWidth = YES;
    lbl.textAlignment = NSTextAlignmentCenter;
    [lbl setFont:[UIFont systemFontOfSize:16]];
    [lbl setTextColor:GRAY];
    [view addSubview:lbl];
    [lbl  mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(lable.mas_bottom).with.offset(15);
        make.centerX.equalTo(view.mas_centerX);
        make.right.offset(-15);
        make.left.offset(15);
    }];


}


-(void)backACtion{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)viewDidLoad {
    self.title = @"关于我们";
    
    [self setUpView];
    UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom] ;
    button.frame = CGRectMake(0, 0, K_Global_BackButton_Width, K_Global_BackButton_Height);
    button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    [button setImage:[UIImage imageNamed:@"back_white_on"] forState:UIControlStateNormal];
    //[button setImage:[UIImage imageNamed:@"back_white_on"] forState:UIControlStateHighlighted];
    [button addTarget:self action:@selector(backACtion) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem * leftButton = [[UIBarButtonItem alloc] initWithCustomView:button];
    self.navigationItem.leftBarButtonItem = leftButton;
    
    [super viewDidLoad];
}

-(void) viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];

    self.navigationController.navigationBarHidden = false;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}



@end
